<?php
if (isset($_POST['changeManagers'])) {
    $_POST['dataHash'];
    $modifyEmployeeResult = modifyEmployee(
            $_SESSION['userName'], $_SESSION['userPassHash'], $_POST['accName'], $_POST['dataHash'], $_POST['empFname'], $_POST['empLname'], $_POST['startDate'], $_POST['endDate'], $_POST['empStatus'], $_POST['address'], $_POST['email'], $_POST['phoneNum'], $_POST['wage']);
}

$allEmployeeInfo = getAllEmployeeDetails($_SESSION['userName'], $_SESSION['userPassHash']);
?>
<h3>Manager Manager</h3>
<div class="container">
    <div class="row">
        <div class="span8">
            <div class="accordion" id="employees-accordion">
                <?php
                foreach ($allEmployeeInfo[1] as $employeeInfo) {
                    ?>
                    <div class="accordion-group">
                        <div class="accordion-heading"><a class="accordion-toggle" data-toggle="collapse" data-parent="#employees-accordion" <?php echo("href=\"#" . $employeeInfo["accName"] . "\""); ?>><?php echo($employeeInfo['empFname'] . " " . $employeeInfo['empLname']); ?> - <?php echo($employeeInfo['empStatus']); ?></a></div>
                        <div <?php echo("id=\"" . $employeeInfo["accName"] . "\""); ?> class="accordion-body collapse">
                            <div class="accordion-inner">
                                <form action="" method="post" class="form-inline">
                                    <select name="empStatus">
                                        <option <?php if ($employeeInfo["empStatus"] == "Manager") echo("selected"); ?> value="Manager">Manager</option>
                                        <option <?php if ($employeeInfo["empStatus"] == "Worker") echo("selected"); ?> value="Worker">Worker</option>
                                    </select>
                                    <input type="hidden" name="accName" value="<?php echo($employeeInfo["accName"]); ?>" />
                                    <input type="hidden" name="dataHash" value="<?php echo($employeeInfo["dataHash"]); ?>" />
                                    <input type="hidden" name="empFname" value="<?php echo($employeeInfo["empFname"]); ?>" />
                                    <input type="hidden" name="empLname" value="<?php echo($employeeInfo["empLname"]); ?>" />
                                    <input type="hidden" name="startDate" value="<?php echo($employeeInfo["startDate"]); ?>" />
                                    <input type="hidden" name="endDate" value="<?php echo($employeeInfo["endDate"]); ?>" />
                                    <input type="hidden" name="address" value="<?php echo($employeeInfo["address"]); ?>" />
                                    <input type="hidden" name="email" value="<?php echo($employeeInfo["email"]); ?>" />
                                    <input type="hidden" name="phoneNum" value="<?php echo($employeeInfo["phoneNum"]); ?>" />
                                    <input type="hidden" name="wage" value="<?php echo($employeeInfo["wage"]); ?>" />
                                    <input type="submit" class="btn" name="changeManagers" value="Save Changes" />
                                </form>
                            </div>
                        </div>
                    </div>
                    <?php
                }
                ?>
            </div>
        </div>
    </div>
</div>